#pragma once
template<class T,class Container>
class queue
{
public:
	void push(const T& a)
	{
		con.push_back(a);
	}
	void pop(const T& b)
	{
		con.pop_front();
	}
	const T& front()
	{
		return con.front();
	}
	const T& back()
	{
		return _con.back();
	}

	size_t size()
	{
		return _con.size();
	}

	bool empty()
	{
		return _con.empty();
	}
private:
	Container con;
};

template<class T>
class Less
{
public:
	bool operator(const T& a, const T& b)
	{
		return a < b;
	}
};

template<class T>
class greater
{
public:
	bool operator(const T& a, const T& b)
	{
		return a > b;
	}
};

template<class T, class Container,class Compare = Less<T>>
class priority_queue
{
public:
	void adjust_up(int child)
	{
		Compare com;
		int parent = (child - 1) / 2;
		while (child > 0)
		{
			if (com(con[parent], con[child]))
			{
				swap(con[child], con[parent]);
				child = (child - 1) / 2;
				parent = (child - 1) / 2;
			}
			else
			{
				break;
			}
		}
	}

	void adjust_down(int parent)
	{
		Compare com;
		int child = parent * 2 + 1;
		while (child < con.size())
		{
			if (child < con.size() && com(con[parent], con[child]))
			{
				child = child + 1;
			}
			if (com(con[parent], con[child]))
			{
				swap(con[child], con[parent]);
				parent = child;
				child = child * 2 + 1;
			}
			else
			{
				break;
			}
		}
	}
	void push(const T& a)
	{
		con.push_back(a);
		adjust_up(con.size() - 1);
	}
	void pop()
	{
		swap(con[0], con[con.size() - 1]);
		adjust_down(0);
	}
	int size()
	{
		return con.size();
	}
	bool empty()
	{
		return con.size();
	}
	const T& top()
	{
		return con[0];
	}

private:
	Container con;
};